# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Thomas Baechler <thomas@archlinux.org>
# Contributor: Jaroslaw Swierczynski <swiergot@juvepoland.com>
# Contributor: Michal Hybner <dta081@gmail.com>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgbase=firefox-i18n
pkgver=62.0.3
pkgrel=1
pkgdesc="Language pack for Firefox"
arch=(any)
license=(MPL GPL LGPL)
url="https://www.mozilla.org/firefox/"

_languages=(
  'ach    "Acholi"'
  'af     "Afrikaans"'
  'an     "Aragonese"'
  'ar     "Arabic"'
  'as     "Assamese"'
  'ast    "Asturian"'
  'az     "Azerbaijani"'
  'be     "Belarusian"'
  'bg     "Bulgarian"'
  'bn-BD  "Bengali (Bangladesh)"'
  'bn-IN  "Bengali (India)"'
  'br     "Breton"'
  'bs     "Bosnian"'
  'ca     "Catalan"'
  'cak    "Maya Kaqchikel"'
  'cs     "Czech"'
  'cy     "Welsh"'
  'da     "Danish"'
  'de     "German"'
  'dsb    "Lower Sorbian"'
  'el     "Greek"'
  'en-GB  "English (British)"'
  'en-US  "English (US)"'
  'en-ZA  "English (South African)"'
  'eo     "Esperanto"'
  'es-AR  "Spanish (Argentina)"'
  'es-CL  "Spanish (Chile)"'
  'es-ES  "Spanish (Spain)"'
  'es-MX  "Spanish (Mexico)"'
  'et     "Estonian"'
  'eu     "Basque"'
  'fa     "Persian"'
  'ff     "Fulah"'
  'fi     "Finnish"'
  'fr     "French"'
  'fy-NL  "Frisian"'
  'ga-IE  "Irish"'
  'gd     "Gaelic (Scotland)"'
  'gl     "Galician"'
  'gn     "Guarani"'
  'gu-IN  "Gujarati (India)"'
  'he     "Hebrew"'
  'hi-IN  "Hindi (India)"'
  'hr     "Croatian"'
  'hsb    "Upper Sorbian"'
  'hu     "Hungarian"'
  'hy-AM  "Armenian"'
  'id     "Indonesian"'
  'is     "Icelandic"'
  'it     "Italian"'
  'ja     "Japanese"'
  'ka     "Georgian"'
  'kab    "Kabyle"'
  'kk     "Kazakh"'
  'km     "Khmer"'
  'kn     "Kannada"'
  'ko     "Korean"'
  'lij    "Ligurian"'
  'lt     "Lithuanian"'
  'lv     "Latvian"'
  'mai    "Maithili"'
  'mk     "Macedonian"'
  'ml     "Malayalam"'
  'mr     "Marathi"'
  'ms     "Malay"'
  'my     "Burmese"'
  'nb-NO  "Norwegian (Bokmål)"'
  'nl     "Dutch"'
  'nn-NO  "Norwegian (Nynorsk)"'
  'or     "Oriya"'
  'pa-IN  "Punjabi (India)"'
  'pl     "Polish"'
  'pt-BR  "Portuguese (Brazilian)"'
  'pt-PT  "Portuguese (Portugal)"'
  'rm     "Romansh"'
  'ro     "Romanian"'
  'ru     "Russian"'
  'si     "Sinhala"'
  'sk     "Slovak"'
  'sl     "Slovenian"'
  'son    "Songhai"'
  'sq     "Albanian"'
  'sr     "Serbian"'
  'sv-SE  "Swedish"'
  'ta     "Tamil"'
  'te     "Telugu"'
  'th     "Thai"'
  'tr     "Turkish"'
  'uk     "Ukrainian"'
  'ur     "Urdu"'
  'uz     "Uzbek"'
  'vi     "Vietnamese"'
  'xh     "Xhosa"'
  'zh-CN  "Chinese (Simplified)"'
  'zh-TW  "Chinese (Traditional)"'
)

pkgname=()
source=()
_url=https://ftp.mozilla.org/pub/firefox/releases/$pkgver/linux-x86_64/xpi

for _lang in "${_languages[@]}"; do
  _locale=${_lang%% *}
  _pkgname=firefox-i18n-${_locale,,}

  pkgname+=($_pkgname)
  source+=("firefox-i18n-$pkgver-$_locale.xpi::$_url/$_locale.xpi")
  eval "package_$_pkgname() {
    _package $_lang
  }"
done

# Don't extract anything
noextract=(${source[@]%%::*})

_package() {
  pkgdesc="$2 language pack for Firefox"
  depends=("firefox>=$pkgver")
  install -Dm644 firefox-i18n-$pkgver-$1.xpi \
    "$pkgdir/usr/lib/firefox/browser/extensions/langpack-$1@firefox.mozilla.org.xpi"
}

sha256sums=('400f38c4232ee42185c8c247e97a273bff669d536ebf1d5eeb3ff05cc426ec42'
            '21a1e675b23ec836bcd5d8043033f3acbaf83ecb6025bde0d9c3e3e2ab50d850'
            '50c266923cd3ea0f528ba3fd20c1839da6e72d2fb456f55ade69fa1d864a5067'
            'eae6f999d4222d0a61105372421f80aa553c4ef1192e38947f79e219bd8c4fa0'
            '1d7ced2600866ac1212d7e87024cb8d147dcc878eb349f7b64629e21cd8177e3'
            '908b8926bcb3277fd6cd6593ba69c6dee22589e0ae835869bb0dfb08fe7e40cd'
            'c630dcff473fdca3061586e746934789b795db60b3cb427da4bdfc0ff225d669'
            '1bdc2d51edd45768c8396a69baac89dce802e8cff875f499014e89f646892b2b'
            '1c191e72b43195bd0b12cee03d3100b1f9c3b93d19304064e5f2b37a9171b21d'
            '4e20199c9454c48feacb04f0297141536ee0601d8b61739ee220b051922398d2'
            'e4fa31c17d2f61cd99e647067c3b7103e6c511e44946a53acf4c7ed034e107d5'
            '4c3ff64d4ca014c901d556ef15291c6d1742c977ec2ec998dd2e89a73169321c'
            '08bfa75fd56e5e3a149492c4f8050208dbc8c32357d77d1ab974c37d91daa23b'
            '186754d5ff978c2cce7188656d02d94d9a661dfa4a8e54a65e351ca5ef11bc8d'
            'ac8a47c2cb463a4ac61e6f89a212e6a7d994f18bf60badb837b2b3e27e429fc4'
            'e113db4fc11c6ac941b19d379172825c4753dfa73fb754838d8c8a77d252a7cd'
            '0b410833e27bc39759693f69c9a6ba12d639d8a97700969a4b6f7f248bdc158f'
            '5b742928a7ce209d2e96d05e8c143010b1a1801127226d18ece5032a92bdd1b3'
            'f43137d3c59f2c154ac44a0a40af2fb2721ebf729001b74264cf0e2652bd9a58'
            'ac8784e9df9150a647cb17bdbce5c7201afa72accedc0f2727f3c8b87eb39b50'
            '25ee30ae6cc67113186a022ee74d29133ef72e10cfe86d07562e5bba5d173369'
            '15139982829d699dec65295fbc899df030e2275512069939e008feadf3331fe3'
            '3e825c4cdca5eba4788d6fdff96b31629fdf62d3bdca15700f137a74b2dec867'
            'ffe1f20becbe7007255d122d9fffe2e9d924f424847ddeb5faf852c58f8ba469'
            '58e087b2c47f9dbf6c53c80335a5e47c23883bfdfaf7255fb8857891543a2c82'
            'b11ed055992d2a97e7dba3bf8712e03e585678253dee4e3615a29c5aefbb95f9'
            'c01336a56974bd8ec835b66d91162ced59eff0f642889c2e95b4c9b10e51b192'
            '4c8019589e429f3277bd14395921ce24d7dec5ce13a8a887a556c5ee8cbda059'
            '475209c0308f39b392db86b06f2baf16ae3c3a53fdeb298f772c42dccebf06da'
            '4d06c7b3382422bdf3b0fc8160aeb8dc144a45eb1fb14576675096744c49c7d1'
            '0d80cb9ebead9a1755a106056d3c1c705951ec1b22b1fdd7cf0478fc03682586'
            'b2ff9fb8ecca109f866e4a741c9703e914b5bed34009eb81267478fb0d637ba9'
            'bcbef311228e644fa856ac43c21b1d1d8cbc865cf1d227060822474e740d6331'
            '9bd8d44f508d8f68eefd44f03068b7c6ab0990ab0fdad5966689ce53d0cefc0c'
            '2c34b7cd7f552f82854712b2dd4ab7b7368889ce3a9f358b7c2313385e7ff516'
            '942dac3f2700e685368a0f82287c3133498503528340a67b4d2b49b40205d2e8'
            '72d0ced7cf28305beb80865a377f2f644ee3356c4f2632e42854d293a090af45'
            'e859014943bf06f2a9a8cf18a932880fcd4e54e49ba58e90525287c1a043217c'
            '584fc5c5a32420b80cb488507b2a2c4cd8e56675c29e4965501972acf9c12c45'
            '1aae86b31d1fe25d1c229869716d5bafdf973b81d9fbf446a31d5d0985a00fd4'
            'f5a06fbf5cdeb0729afce33d353071f1e0cb203818a607b4104fa210dc78e399'
            '67d00e319d000da45a1184c3f1a96015c2c1ea857390bf7fb32258767ce3e191'
            '8f61ffd90b004808a7f95d752789871f3fba6d075222bab0fb4302228cacbec1'
            '792b035430fe73c1427881713dd50c2d49779d76d0c9e698f7050278cf6cafb3'
            'c88db766624580139c9119683178e4d658717b365012a04c748a003692983afd'
            'd1b3aaf057e428fd03e924009c8f58eaa1cd927f4deffd5d8666aef341ff54f9'
            'ba765f45d683c8bc911a715373cba8fc50fb56064acb4354b761c700d619d9e9'
            '8aef485ee83b5b11c5808013681cb09e419131b9386c0879ae02e1df8ea29f74'
            'f47fa1deb96dddd262d3557e67bb3f35fc87cef07d27ddb982adf4ae5012a6be'
            '875123a182895f2fbeee223c208a88b6a13ac5a4468697e906233406dc3dcca5'
            'bd8d102bea1a57f55fe0f7e9a987b8a8e14b50a40f181c67e75050badd3764c2'
            'eae53cb8d6703c4722e7755bfbd0aed01c4c462949c292a1aab3ed7f50b68cea'
            '3f149a8c86f5c238d1649a5aaf0196b2e362217c334e138bc879e15557b8b30e'
            'e0efeb01df8898f302ff15e7e750cca102f9de2141e800335be0f8faf9ee39ab'
            '55258e74d455b6ebfc6f60c68e45404a04aacede76139a309fd0a6da0fdc2846'
            'b39aa928053047e68315425e829861de903836b000be9c57120679c2b2d3a93e'
            'bc46be021608035d318babb320ea9703b103c0d706f656704a0c0c2f3243ab3b'
            'e0f48937d67a6b614e281f069eab3e76a9b559e4f34e9a192bc0d5ca932af105'
            '2cae97570af6b6d48eba32308c1b24fcfa53c7387aede5ca2eda2be6901c6ff1'
            '1805344100f6910b0eb33618ae043545d358861ebc419460fc19b62bf7331d44'
            '08ec1feb9b95391e14a4c881ee7c3ebbbd983688db3621a8c8b470375f1708e2'
            '6657805984c2704fb413ed80ff00679d513a88a3486b59abd2741453eaaa85fe'
            'fc43a64a19b35c44029d032920fa7787313a7630a4e633682f76cf09c67d2f42'
            '6a2cfe96c0947af68c0e1b3e7716a1900933a01dff411fc4d4599e6c928abd7f'
            'a3c201b186a91b3bacab23ff67589bb72ec65da26f2c92123637e435addcd1dc'
            'be6f0cc7f50364457f77eded64f52ecb684363a4316ccfdf3f3181dce0451174'
            'fdd823e227fadde823ba62590bdfea48766851ae10965d481e13902a250b4e17'
            'f470c9ab403a9b76997bcbefd4685c8925f0e93dd6056c8230875eb7bb7be4b5'
            'f64b40f808e32169e5feb62eae5b4163541318a5f628737d1b200b0be235d5f9'
            '7c92029df4a549eb355f8fab1c6756d66b3a4e7919fc65969304f62132b7a67b'
            '13bbd53588574db65b2f1d952a10ac2b99520a86064ddfcdbbb5517131161d35'
            '45971007aa565a0b13791b2aff2e929f90f61836886c4f7a52f8b340450684a3'
            '4a8c0bc97305d59a5e69996419c5b25280d7af1807abe91fc03ce6f7126decae'
            '7c61353d67b8206330f486ebdf1dfbe14a8e62b03e9b05acc11308c1df6e264d'
            '0010c96776c3057a54d5228aba7aa9e0e0e0ec5632f8bd8b45d2c01d27aa5c7e'
            '2580e2271e35bb3aace53678920c4cfc77f34ef0633386f5362ef02638e63525'
            '316b4341ea88192b3f95e339f5989449a80ad76768df0b822747c3282dbe4eff'
            'f8d03b7dd8ce0f3c54b0237059819c5bb952c3002ca2c2499a0fa18d39290c4b'
            '36214d183f778718b8b7fd242e6609b497e176f98c2b1906825d6577b6131bab'
            '38cfe4e7b7bf7cebd1149cd1820b73fe4813a3ffae250ac6769b5c13c24d362f'
            '4dcae84379316a74aaa0a7d3a84a2bde2717db8556420acdef53b2133a939aa1'
            'c30b3145d7e3bfbcac77d5fc2796d430b6798ea0d1d7d74ef3add6278418d494'
            '5c1f0129e2780ebbb51adce107af13010208bab304ef3fbecbd7bbdb3cbcfac9'
            '58c40837e33d6d4a5ee03dd7921af98708df7428cf2a87f3c2ec0ef12c2d9b9b'
            '8cb4115d3e47e44e2b5105404e1031bc66bb99b74e86cb58844765076fbca03a'
            'a5888ed43e5213d93a377cb57bb020bf77c81997f9745ee50fde5b7229f602ed'
            '47b31b1f3edb13325b085d80cfe6a1a785b414b333db7a3308c4366269b83bed'
            'a48188dbec06ec384c6fc1c23ee2d609300691165e508955051bd4f024d99efd'
            '78585ec621bc4af581a79a0e447fcdb2c041379aa966b8ba51e7adb22f24c2aa'
            '6240d8aa0247820d339d2dcf896f31b3ac8ca6ec463ef4d494f58873f763bca3'
            '5ad614f2ac62d8b8f3e7ca96f68dd90747749846218374ed37304e1ce8f0260b'
            '83f0d6986d1fe2ba2d4a70ca0240a5a42cbffc370461586304444dce3e7c0e0c'
            '116b96da3549f1204b2ff0f6dc40b0f780daf3bd444e48a943d60658b653c001'
            'f5f326b10857073c63317d41ffbd2c2208f1104839df62d57bea4065c406e5ef'
            'bad9eb5db7cb2c9b650fa8f2abee0129d43bb2f236c725482b793f6c854f90a9')
